#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright @ 2014 OPS, Qunar Inc. (qunar.com)
#
# Author: tingfang.bao <tingfang.bao@qunar.com>
# DateTime: 15-3-9 上午11:34
from flask import Flask

app = Flask(__name__)


# 这个一定会发生,即使before_request没有执行，或者发生了异常
@app.teardown_request
def teardown_request(exception=None):
    print 'teardown request ...'


ctx = app.test_request_context()
print 'before request context'
ctx.push()
print 'in request context'
ctx.pop()
print 'ended request context'